package com.atguigu.guli.service.vod.controller.api;

import com.atguigu.guli.service.base.exception.GuliException;
import com.atguigu.guli.service.base.result.R;
import com.atguigu.guli.service.base.result.ResultCodeEnum;
import com.atguigu.guli.service.vod.service.MediaService;
import io.swagger.annotations.Api;
import io.swagger.annotations.ApiParam;
import lombok.extern.slf4j.Slf4j;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.*;
import org.springframework.web.multipart.MultipartFile;


import javax.annotation.Resource;
import java.io.IOException;
import java.io.InputStream;

@RestController
@Slf4j

@RequestMapping("/api/vod/media")
@Api("云视频点播")
public class ApiMediaController {

    @Resource
    private MediaService mediaService;

    @GetMapping("getUrlById/{videoId}")
    public R getPlayUrl(@PathVariable String videoId){
        String playUrl = mediaService.getPlayUrl(videoId);
        return R.ok().data("playUrl",playUrl);
    }

    @GetMapping("getPlayAuth/{videoId}")
    public R getPlayAuth(@PathVariable String videoId){
        String playAuth = mediaService.getPlayAuth(videoId);
        return R.ok().data("playAuth",playAuth);
    }
}
